/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.omazan.db.models;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author stryke
 */
@Entity
@Table(name = "DELIVERYSTATUS", catalog = "OMAZANDB", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Deliverystatus.findAll", query = "SELECT d FROM Deliverystatus d"),
    @NamedQuery(name = "Deliverystatus.findByStatusId", query = "SELECT d FROM Deliverystatus d WHERE d.statusId = :statusId"),
    @NamedQuery(name = "Deliverystatus.findByDescription", query = "SELECT d FROM Deliverystatus d WHERE d.description = :description"),
    @NamedQuery(name = "Deliverystatus.findByIsActive", query = "SELECT d FROM Deliverystatus d WHERE d.isActive = :isActive")})
public class Deliverystatus implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "statusId", nullable = false)
    private Integer statusId;
    @Size(max = 255)
    @Column(name = "description", length = 255)
    private String description;
    @Basic(optional = false)
    @NotNull
    @Column(name = "isActive", nullable = false)
    private boolean isActive;
    @OneToMany(mappedBy = "statusId", fetch = FetchType.LAZY)
    private Collection<Orders> ordersCollection;

    public Deliverystatus() {
    }

    public Deliverystatus(Integer statusId) {
        this.statusId = statusId;
    }

    public Deliverystatus(Integer statusId, boolean isActive) {
        this.statusId = statusId;
        this.isActive = isActive;
    }

    public Integer getStatusId() {
        return statusId;
    }

    public void setStatusId(Integer statusId) {
        this.statusId = statusId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean getIsActive() {
        return isActive;
    }

    public void setIsActive(boolean isActive) {
        this.isActive = isActive;
    }

    @XmlTransient
    public Collection<Orders> getOrdersCollection() {
        return ordersCollection;
    }

    public void setOrdersCollection(Collection<Orders> ordersCollection) {
        this.ordersCollection = ordersCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (statusId != null ? statusId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Deliverystatus)) {
            return false;
        }
        Deliverystatus other = (Deliverystatus) object;
        if ((this.statusId == null && other.statusId != null) || (this.statusId != null && !this.statusId.equals(other.statusId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.omazan.entities.Deliverystatus[ statusId=" + statusId + " ]";
    }
    
}
